import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:xinxuan/common/appbar_util.dart';
import 'package:xinxuan/common/scroll_configuration_common.dart';
import 'package:xinxuan/controllers/article_controller/article_detail_page_controller.dart';
import 'package:get/get.dart';
import 'package:xinxuan/utils/color_util.dart';

class ArticleDetailPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    Map<String, dynamic> argumentsMap = Get.arguments;
    String title = argumentsMap['title'] ?? '';
    return Scaffold(
      backgroundColor: bgWhiteColor,
      appBar: AppBarUtil(
        title: title,
        backgroundColor: pageBgColor,
      ),
      body: GetBuilder<ArticleDetailPageController>(
        init: ArticleDetailPageController(),
        builder: (controller) {
          return ScrollConfigurationCommon(child: SingleChildScrollView(
            child: HtmlWidget(
              '${controller.articleDetailData.value.content}',
              customStylesBuilder: (element) {
                return {
                  'vertical-align': 'middle'
                };
              },
            ),
          ));
        },
      ),
    );
  }
}